{% extends "base/front.html" %}

{% block title %}首页{% endblock %}

{% block PathNavigation %}
			<ul class="breadcrumb">
				<li class="active">
					当前位置：<a href="{{ url_for('front.index') }}">首页</a>
				</li>
			</ul>
{% endblock %}

{% block container %}
            <!-- 置顶文章列表 -->
			<div class="row clearfix">
				<div class="col-md-12 column">
				    <h3><scan class="icon-fire icon-large"> 置顶文章</scan></h3>
				    <ol>
                    {% for blog in g.api.blog_get_top_data().data %}
			            <li><a href="{{ url_for('front.blogShow', bid=blog.id) }}">{{ blog.title }}</a></li>
                    {% endfor %}
                    </ol>
				</div>
			</div>

            <!-- 文章列表缩略 -->
            <h3><scan class="icon-book icon-large"> 最新文章</scan></h3>
            {% set blogs = g.api.blog_get_single_index(page=request.args.get("page", 0), length=request.args.get("length", 8)) %}
            <blockquote>
            {% for blog in blogs.data %}
			<div class="row clearfix">
				<div class="col-md-12 column">
					<h4 class="text-left text-success">
						<a href="{{ url_for('front.blogShow', bid=blog.id) }}" style="color: blue; font-weight: bold;">{{ blog.title }}</a>
					</h4>
					<h5>
					    {% if blog.author %}
					    <small><i class="icon-user icon-1x"></i><a href="{{ url_for('front.userHome', user=blog.author) }}" title="由 {{ blog.author }} 发布" style="color: #999">&nbsp;{{ blog.author }}</a>&nbsp;</small>
					    {% endif %}

                        {% if blog.catalog %}
					    <small><i class="icon-folder-open icon-1x"></i><a href="{{ url_for('front.blogResource', resource_type='catalog', resource_data=blog.catalog) }}" title="查看 {{ blog.catalog }} 分类中所有文章" style="color: #999">&nbsp;{{ blog.catalog }}</a>&nbsp;</small>
					    {% endif %}

                        {% if blog.tag %}
					    <small><i class="icon-tag icon-1x"></i>
					    {% for tag in blog.tag.split() %}
					        <a href="{{ url_for('front.blogResource', resource_type='tag', resource_data=tag) }}" title="查看 {{ tag }} 标签中所有文章" style="color: #999">{{ tag }}</a>&nbsp;
					    {% endfor %}
					    </small>
					    {% endif %}

                        {% if blog.create_time %}
					    <small><i class="icon-calendar icon-1x"></i><scan style="color: #999">&nbsp;{{ blog.create_time }}</scan>&nbsp;</small>
					    {% endif %}

					    {%- if g.plugins.ChangyanComment.enable in ('true', 'True', True) %}
                        <small><i class="icon-comment-alt icon-1x"></i><a href="{{ url_for('front.blogShow', bid=blog.id) }}#SOHUCS" title="《{{ blog.title }}》 上的评论" style="color: #999">&nbsp;评论{{ g.api.misc_get_commend(blog.id).data.comments }}次</a>&nbsp;</small>
                        {% endif -%}
					</h5>
				</div>
			</div>
			{% endfor %}
			</blockquote>

			<!-- 分页 -->
			{% set prev = blogs.page.page - 1 %}
			{% set next = blogs.page.page + 1 %}
			{% set last = blogs.page.PageCount - 1 %}
			<center>
			<ul class="pagination pagination-lg">
			    {%- if blogs.page.page == 0 %}
				<li class="disabled"><a>Prev</a></li>
				{% else -%}
				<li><a href="{{ url_for('front.index', page=prev) }}">Prev</a></li>
				{% endif -%}
				{%- for p in range(blogs.page.PageCount) %}
				    {%- if blogs.page.page == p -%}
				        <li class="disabled"><a>{{ p }}</a></li>
				    {%- else -%}
				        <li><a href="{{ url_for('front.index', page=p) }}">{{ p }}</a></li>
				    {% endif -%}
                {% endfor -%}
			    {% if blogs.page.page == last %}
				<li class="disabled"><a>Next</a></li>
				{% else %}
				<li><a href="{{ url_for('front.index', page=next) }}">Next</a></li>
				{%- endif %}
			</ul>
			</center>
{% endblock %}